$(function () {
    var payinfo_datagrid = $("#payinfo_datagrid");


    var cmdObj = {
        //工具栏的刷新
        reload: function () {
            payinfo_datagrid.datagrid("reload");
        },
        /*高级查询*/
        query:function () {
            var kw = $("#keyword").textbox("getValue");
            payinfo_datagrid.datagrid("load", {
                keyword: kw
            });
        }
    }

    //调用
    $("a[data-cmd]").click(function () {
        var cmd = $(this).data("cmd");
        cmdObj[cmd]();
    });

    payinfo_datagrid.datagrid({

        url: "/compensationInfo/query",
        fit: true,
        fitColumns: true,
        striped: true,
        singleSelect: true,
        pagination: true,
        rownumbers: true,
        columns: [[
            {field: "ck", checkbox: true},//显示多选框样式
            {field: "id", hidden: true},
            {
                field: 'beneficiary', title: '受益人', width: 80
            },
            {
                field: "guaranteeBill", title: "保险单号", width: 100, formatter: function (value, row, index) {
                    if(value==null){
                        return;
                    }
                    return value.number;
                }
            },
            {field: "accountnum", title: "收款账户", width: 100},
            {field: "amount", title: "赔款金额", width: 100}
        ]],
        toolbar: '#tb'
    });

});



